import React from 'react';
import ReactDOM from 'react-dom';

export default class ComponentBody extends React.Component{
	render(){
		// 这里是js注释
		var userName = "张三";
		let buttonVal = "按钮";
		let bool = false; 
		let html = "react&nbsp;demos";
		let htmlold = "react demos";
		let htmlU ="react\u0020demos";
		return(
			<div>
				<p>{userName=="" ? "用户名为空" : "用户名为:" + userName}</p>
				{/*绑定数据是单个花括号*/}
				<p><input type="button" value={buttonVal} disabled={bool} /></p>
				{/*需要进行Unicode转码输出空格*/}
				<p>{htmlU}</p>
				{/*这样也可以直接输出空格*/}
				<p>{htmlold}</p>
				{/*会造成xss攻击 可以通过后台程序判断*/}
				<p dangerouslySetInnerHTML = {{__html : html}}></p>
			</div>
		)
	}		
}